package com.itheima.d5_synchronized_lock;

import com.itheima.d2_thread_safe.Account;

/**
 * 目标：模拟线程安全问题。
 */
public class ThreadTest3 {
    public static void main(String[] args) {
        final Account3 account = new Account3("0001",1000000.0);
        final Person person = new Person("小红", account);
        final Person person1 = new Person("小明", account);

        person.start();
        person1.start();
    }


}

class Person extends Thread{
    private final Account3 account;

    public Person(String name, Account3 account) {
        super(name);
        this.account = account;

    }

    @Override
    public void run() {
        account.drawMoney(100000.0);
    }
}